package Reflect;

import Reflect.annotations.AutoRunMethod;

import java.lang.reflect.Method;

public class Test2 {
    public static void main(String[] args) throws Exception {
        Class cls = Class.forName("Reflect.Person");
        Object obj = cls.newInstance();
        Method [] methods = cls.getMethods();
        for (Method method : methods){
            if (method.isAnnotationPresent(AutoRunMethod.class)){
                method.invoke(obj);
                System.out.println(method);
            }
        }
    }
}
